<?php
// config/db.php
declare(strict_types=1);

$DB_HOST = '127.0.0.1';
$DB_NAME = 'ldp_db';
$DB_USER = 'root';
$DB_PASS = ''; // default XAMPP MySQL root has no password

$options = [
  PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
  PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
  PDO::ATTR_EMULATE_PREPARES   => false,
];

try {
  $pdo = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME;charset=utf8mb4", $DB_USER, $DB_PASS, $options);
} catch (Throwable $e) {
  http_response_code(500);
  exit('Database connection failed.');
}
